import request from '@/router/axios';

export const getDimensionByGroup = (group) => {
  return request({
    url: '/api/beetles-offer/offer-report/get-dimension-by-group',
    method: 'get',
    params: {
      group
    }
  });
}

export const getTemplateList = (offerId) => {
  return request({
    url: '/api/beetles-offer/offer-report/get-own-template',
    method: 'get',
    params: { 'offerId': offerId }
  });
}

export const saveTemplate = (data) => {
  return request({
    url: '/api/beetles-offer/offer-report/save-template',
    method: 'post',
    data: data
  });
}

export const updateTemplate = (data) => {
  return request({
    url: '/api/beetles-offer/offer-report/update-template',
    method: 'put',
    data: data
  });
}

export const deleteTemplate = (ids) => {
  return request({
    url: '/api/beetles-offer/offer-report/remove-template',
    method: 'delete',
    params: {ids}
  });
}

export const updateUseTime = (id) => {
  return request({
    url: '/api/beetles-offer/offer-report/update-use-time',
    method: 'put',
    params: {id}
  });
}

export const getReport = (data) => {
  return request({
    url: '/api/beetles-offer/offer-report/get-report',
    method: 'post',
    timeout: 30 * 1000,
    data: data
  });
}

export const getReportTotal = (data) => {
  return request({
    url: '/api/beetles-offer/offer-report/get-report-total',
    method: 'post',
    data: data
  });
}

export const exportReport = (data) => {
  return request({
    url: '/api/beetles-offer/offer-report/export-report',
    method: 'post',
    data: data,
    responseType: 'blob'
  });
}

export const getEventByOfferId = (offerId) => {
  return request({
    url: '/api/beetles-business/app/get-event-by-offer-id',
    method: 'get',
    params: { offerId }
  });
}

// 获取媒体事件列表
export const getPlatformEventByOfferId = (offerId) => {
  return request({
    url: '/api/beetles-business/app/get-platform-event-by-offer-id',
    method: 'get',
    params: { offerId }
  });
}
